<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta name="referrer" content="no-referrer"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>打破砂锅问~WPF原理(01:WPF体系结构) | Welcome,Guys,Join Me for the AIminminAI Episode!</title><meta name="author" content="Hu hb"><meta name="copyright" content="Hu hb"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="@TOC  前言做项目的时候，用到了WPF，总结下来，供以后参考，与诸君共勉。 一、Windows Presentation Foundation (WPF)1.先补个作业： Windows Presentation Foundation (WPF) ，Windows呈现基础，是微软新发布的Vista操作系统的三个核心开发库之一，是微软推出的基于Windows Vista的用户界面框架，属于. N">
<meta property="og:type" content="article">
<meta property="og:title" content="打破砂锅问~WPF原理(01:WPF体系结构)">
<meta property="og:url" content="https://aiminminai.gitee.io/aiminminai/2024/02/24/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86-01-WPF%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/index.html">
<meta property="og:site_name" content="Welcome,Guys,Join Me for the AIminminAI Episode!">
<meta property="og:description" content="@TOC  前言做项目的时候，用到了WPF，总结下来，供以后参考，与诸君共勉。 一、Windows Presentation Foundation (WPF)1.先补个作业： Windows Presentation Foundation (WPF) ，Windows呈现基础，是微软新发布的Vista操作系统的三个核心开发库之一，是微软推出的基于Windows Vista的用户界面框架，属于. N">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://aiminminai.gitee.io/aiminminai/img/avatar.jpg">
<meta property="article:published_time" content="2024-02-24T13:00:39.000Z">
<meta property="article:modified_time" content="2024-02-28T15:11:09.996Z">
<meta property="article:author" content="Hu hb">
<meta property="article:tag" content="WPF体系结构">
<meta property="article:tag" content="INotifyPropertyChanged">
<meta property="article:tag" content="ICommand">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://aiminminai.gitee.io/aiminminai/img/avatar.jpg"><link rel="shortcut icon" href="/aiminminai/img/favicon.png"><link rel="canonical" href="https://aiminminai.gitee.io/aiminminai/2024/02/24/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86-01-WPF%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/aiminminai/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/aiminminai/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: 'days',
  dateSuffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: {"limitCount":50,"languages":{"author":"Author: Hu hb","link":"Link: ","source":"Source: Welcome,Guys,Join Me for the AIminminAI Episode!","info":"Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source."}},
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: true,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '打破砂锅问~WPF原理(01:WPF体系结构)',
  isPost: true,
  isHome: false,
  isHighlightShrink: true,
  isToc: true,
  postUpdate: '2024-02-28 23:11:09'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/aiminminai/img/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/aiminminai/archives/"><div class="headline">Articles</div><div class="length-num">29</div></a><a href="/aiminminai/tags/"><div class="headline">Tags</div><div class="length-num">47</div></a><a href="/aiminminai/categories/"><div class="headline">Categories</div><div class="length-num">42</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/aiminminai/"><i class="fa-fw fas fa-home"></i><span> Home(主页)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives(那些年的知识归档)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags(那些年的知识标签)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories(那些年的工作经验)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/link/"><i class="fa-fw fas fa-link"></i><span> Link(那些年的八股)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/game/"><i class="fa-fw fas fa-heart"></i><span> Game Area(游戏专区，学&amp;玩)</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/aiminminai/img/JingSeOne.jpg')"><nav id="nav"><span id="blog-info"><a href="/aiminminai/" title="Welcome,Guys,Join Me for the AIminminAI Episode!"><span class="site-name">Welcome,Guys,Join Me for the AIminminAI Episode!</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/aiminminai/"><i class="fa-fw fas fa-home"></i><span> Home(主页)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives(那些年的知识归档)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags(那些年的知识标签)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories(那些年的工作经验)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/link/"><i class="fa-fw fas fa-link"></i><span> Link(那些年的八股)</span></a></div><div class="menus_item"><a class="site-page" href="/aiminminai/game/"><i class="fa-fw fas fa-heart"></i><span> Game Area(游戏专区，学&amp;玩)</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">打破砂锅问~WPF原理(01:WPF体系结构)</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2024-02-24T13:00:39.000Z" title="Created 2024-02-24 21:00:39">2024-02-24</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2024-02-28T15:11:09.996Z" title="Updated 2024-02-28 23:11:09">2024-02-28</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/aiminminai/categories/%E5%8E%9F%E7%90%86%E4%B8%8E%E6%BA%90%E7%A0%81/">原理与源码</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/aiminminai/categories/%E5%8E%9F%E7%90%86%E4%B8%8E%E6%BA%90%E7%A0%81/WPF%E5%8E%9F%E7%90%86%E6%8E%A2%E6%8E%A2%E6%8E%A2%EF%BC%88%E4%B8%80%EF%BC%89/">WPF原理探探探（一）</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/aiminminai/categories/%E5%8E%9F%E7%90%86%E4%B8%8E%E6%BA%90%E7%A0%81/WPF%E5%8E%9F%E7%90%86%E6%8E%A2%E6%8E%A2%E6%8E%A2%EF%BC%88%E4%B8%80%EF%BC%89/WPF%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/">WPF体系结构</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="打破砂锅问~WPF原理(01:WPF体系结构)"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p>@<a href="%E6%96%87%E7%AB%A0%E7%9B%AE%E5%BD%95">TOC</a></p>
<hr>
<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>做项目的时候，用到了WPF，总结下来，供以后参考，与诸君共勉。</p>
<h1 id="一、Windows-Presentation-Foundation-WPF"><a href="#一、Windows-Presentation-Foundation-WPF" class="headerlink" title="一、Windows Presentation Foundation (WPF)"></a>一、Windows Presentation Foundation (WPF)</h1><h2 id="1-先补个作业："><a href="#1-先补个作业：" class="headerlink" title="1.先补个作业："></a>1.先补个作业：</h2><ul>
<li>Windows Presentation Foundation (WPF) ，Windows呈现基础，是微软新发布的Vista操作系统的三个核心开发库之一，是微软推出的基于Windows Vista的用户界面框架，属于. NET Framework 3.0的一部分。</li>
</ul>
<h2 id="2-WPF-主要编程模型编写。"><a href="#2-WPF-主要编程模型编写。" class="headerlink" title="2.WPF 主要编程模型编写。"></a>2.WPF 主要编程模型编写。</h2><ul>
<li>在WPF主要组件中：（PresentationFramework、PresentationCore 和 milcore）是 WPF 的主要代码部分<ul>
<li>PresentationFramework<ul>
<li>托管组件【托管代码就是执行过程交由运行时管理的代码， 在这种情况下，相关的运行时称为公共语言运行时 (CLR)，不管使用的是哪种实现（例如 Mono、.NET Framework 或 .NET Core&#x2F;.NET 5+）。 CLR 负责提取托管代码、将其编译成机器代码，然后执行它。 除此之外，运行时还提供多个重要服务，例如自动内存管理、安全边界和类型安全。】</li>
</ul>
</li>
<li>PresentationCore<ul>
<li>托管组件</li>
</ul>
</li>
<li>milcore<ul>
<li>非托管组件<ul>
<li>milcore 是以非托管代码编写的，目的是实现与 DirectX 的紧密集成。</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="3-WPF-中的所有显示均通过-DirectX-引擎完成"><a href="#3-WPF-中的所有显示均通过-DirectX-引擎完成" class="headerlink" title="3.WPF 中的所有显示均通过 DirectX 引擎完成"></a>3.WPF 中的所有显示均通过 DirectX 引擎完成</h2><h2 id="4-WPF-中的大多数对象派生自-DispatcherObject"><a href="#4-WPF-中的大多数对象派生自-DispatcherObject" class="headerlink" title="4.WPF 中的大多数对象派生自 DispatcherObject"></a>4.WPF 中的大多数对象派生自 DispatcherObject</h2><h2 id="5-System-Windows-DependencyObject"><a href="#5-System-Windows-DependencyObject" class="headerlink" title="5.System.Windows.DependencyObject"></a>5.System.Windows.DependencyObject</h2><ul>
<li>生成 WPF 时使用的主要体系结构原理之一是首选属性而不是方法或事件。<ul>
<li>属性具有声明性，可更方便地指定用途而不是操作。它还支持模型驱动或数据驱动的系统，以显示用户界面内容。 这种理念的预期效果是创建更多可以绑定到的属性，从而更好地控制应用程序的行为。</li>
</ul>
</li>
<li>WPF 提供一个更丰富的属性系统，该属性系统从 DependencyObject 类型派生。 该属性系统实际是一个“依赖”属性系统，因为它会跟踪属性表达式之间的依赖关系，并在依赖关系更改时自动重新验证属性值。<ul>
<li>比如，如果具有一个可继承的属性（如 FontSize），当继承该值的元素的父级发生属性更改时，系统会自动更新。</li>
<li>属性系统还提供属性值的稀疏存储。 因为对象可能有数十个（如果达不到上百个）属性，并且大部分值处于其默认状态（被继承、由样式设置等），所以并非对象的每个实例都需要具有在其上定义的每个属性的完全权重。</li>
<li>属性系统的最后一个新功能是附加属性的概念。 WPF 元素是基于组合和组件重用的原则生成的。 某些包含元素（如 Grid 布局元素）通常需要子元素上的其他数据才能控制其行为（如行&#x2F;列信息）。 任何对象都可以为任何其他对象提供属性定义</li>
</ul>
</li>
</ul>
<h2 id="6-System-Windows-Media-Visual"><a href="#6-System-Windows-Media-Visual" class="headerlink" title="6.System.Windows.Media.Visual"></a>6.System.Windows.Media.Visual</h2><ul>
<li>定义一个系统后，下一步是将像素绘制到屏幕上。 Visual 类用于生成视觉对象的树，每个树可以选择性地包含绘制指令以及有关如何呈现这些指令（剪裁、转换等）的元数据。</li>
<li>Visual 实际上是 WPF 复合系统的入口点</li>
<li>WPF 通过遍历由 milcore 管理的非托管数据结构来显示数据。 这些结构（称为组合节点）代表层次结构显示树，其中每个节点都有呈现指令。 只能通过消息传递协议来访问此树</li>
<li>在图形方面，WPF 使用保留呈现系统。<ul>
<li>这可以实现以高刷新率重绘系统</li>
<li>并且组合系统不会阻止对用户代码的回调</li>
</ul>
</li>
<li>WPF 使用“绘画器的算法”绘制模型<ul>
<li>要求每个组件从显示内容的背面绘制到正面，而不是剪裁每个组件。 </li>
<li>这允许每个组件在先前组件的显示内容上绘制。 此模型的优点是可以生成部分透明的复杂形状。 通过使用当今的新式图形硬件，此模型的速度相对较快</li>
</ul>
</li>
</ul>
<h2 id="7-System-Windows-UIElement"><a href="#7-System-Windows-UIElement" class="headerlink" title="7.System.Windows.UIElement"></a>7.System.Windows.UIElement</h2><ul>
<li>UIElement 定义核心子系统，包括布局、输入和事件<ul>
<li>布局是 WPF 中的核心概念<ul>
<li>比如，（HTML 支持三种布局模型：流、绝对和表）</li>
</ul>
</li>
</ul>
</li>
<li>UIElement 还引入了 CommandBindings 的概念。 WPF 命令系统允许开发人员以命令终结点（一种用于实现 ICommand 的功能）的方式定义功能。</li>
</ul>
<h1 id="二、数据模型（属性）、交互模型（命令和事件）及显示模型（模板）之间的划分，可实现对控件的外观和行为的完全自定义"><a href="#二、数据模型（属性）、交互模型（命令和事件）及显示模型（模板）之间的划分，可实现对控件的外观和行为的完全自定义" class="headerlink" title="二、数据模型（属性）、交互模型（命令和事件）及显示模型（模板）之间的划分，可实现对控件的外观和行为的完全自定义"></a>二、数据模型（属性）、交互模型（命令和事件）及显示模型（模板）之间的划分，可实现对控件的外观和行为的完全自定义</h1><ul>
<li>WPF 中数据绑定的最值得关注的功能之一是引入了数据模板。<ul>
<li>控件的最重要功能是模板化。<ul>
<li>如果将 WPF 的组合系统视为一个保留模式绘制系统，则控件可通过模板化以一种参数化的声明性方式描述其绘制。</li>
<li>控件模板是 WPF 样式和模板模型提供的众多功能之一。<ul>
<li>在许多情况下不需要编写自己的控件。</li>
</ul>
</li>
<li>ControlTemplate 实际上只是用于创建一组子元素的脚本，绑定到由控件提供的属性。<ul>
<li>ControlTemplate旨在成为一个独立的实现细节单元，对外部用户和对象（包括样式）不可见。操作控件模板内容的唯一方法是在同一控件模板内。</li>
</ul>
</li>
<li>Control 提供一组常用属性，例如 Foreground、Background、Padding，模板作者可以使用这些常用属性来自定义控件的显示。</li>
</ul>
</li>
</ul>
</li>
</ul>
<figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br></pre></td><td class="code"><pre><code class="hljs C#"><span class="hljs-comment">//调度对象 Scheduling object -&gt; 框架模板 frame template -&gt; 控制模板 control template</span><br><span class="hljs-comment">//设置Button的ControlTemplate的Button Style：</span><br>&lt;Style TargetType=<span class="hljs-string">&quot;Button&quot;</span>&gt;<br>  &lt;!--Set to <span class="hljs-literal">true</span> to <span class="hljs-keyword">not</span> <span class="hljs-keyword">get</span> any properties <span class="hljs-keyword">from</span> the themes.--&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;OverridesDefaultStyle&quot;</span> Value=<span class="hljs-string">&quot;True&quot;</span>/&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;Template&quot;</span>&gt;<br>    &lt;Setter.Value&gt;<br>      &lt;ControlTemplate TargetType=<span class="hljs-string">&quot;Button&quot;</span>&gt;<br>        &lt;Grid&gt;<br>          &lt;Ellipse Fill=<span class="hljs-string">&quot;&#123;TemplateBinding Background&#125;&quot;</span>/&gt;<br>          &lt;ContentPresenter HorizontalAlignment=<span class="hljs-string">&quot;Center&quot;</span><br>                            VerticalAlignment=<span class="hljs-string">&quot;Center&quot;</span>/&gt;<br>        &lt;/Grid&gt;<br>      &lt;/ControlTemplate&gt;<br>    &lt;/Setter.Value&gt;<br>  &lt;/Setter&gt;<br>&lt;/Style&gt;<br><span class="hljs-comment">//当咱们将控件的Template属性设置为新的ControlTemplate（如上例所示）时，咱们需要将替换整个模板。按钮获得焦点或按下时的外观都是要替换的按钮的默认外观的一部分。因此，根据需要，可能需要在定义中添加按下按钮时的外观</span><br>&lt;Style TargetType=<span class="hljs-string">&quot;Button&quot;</span>&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;SnapsToDevicePixels&quot;</span><br>          Value=<span class="hljs-string">&quot;true&quot;</span> /&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;OverridesDefaultStyle&quot;</span><br>          Value=<span class="hljs-string">&quot;true&quot;</span> /&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;FocusVisualStyle&quot;</span><br>          Value=<span class="hljs-string">&quot;&#123;StaticResource ButtonFocusVisual&#125;&quot;</span> /&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;MinHeight&quot;</span><br>          Value=<span class="hljs-string">&quot;23&quot;</span> /&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;MinWidth&quot;</span><br>          Value=<span class="hljs-string">&quot;75&quot;</span> /&gt;<br>  &lt;Setter Property=<span class="hljs-string">&quot;Template&quot;</span>&gt;<br>    &lt;Setter.Value&gt;<br>      &lt;ControlTemplate TargetType=<span class="hljs-string">&quot;Button&quot;</span>&gt;<br>        &lt;Border TextBlock.Foreground=<span class="hljs-string">&quot;&#123;TemplateBinding Foreground&#125;&quot;</span><br>                x:Name=<span class="hljs-string">&quot;Border&quot;</span><br>                CornerRadius=<span class="hljs-string">&quot;2&quot;</span><br>                BorderThickness=<span class="hljs-string">&quot;1&quot;</span>&gt;<br>          &lt;Border.BorderBrush&gt;<br>            &lt;LinearGradientBrush StartPoint=<span class="hljs-string">&quot;0,0&quot;</span><br>                                 EndPoint=<span class="hljs-string">&quot;0,1&quot;</span>&gt;<br>              &lt;LinearGradientBrush.GradientStops&gt;<br>                &lt;GradientStopCollection&gt;<br>                  &lt;GradientStop Color=<span class="hljs-string">&quot;&#123;DynamicResource BorderLightColor&#125;&quot;</span><br>                                Offset=<span class="hljs-string">&quot;0.0&quot;</span> /&gt;<br>                  &lt;GradientStop Color=<span class="hljs-string">&quot;&#123;DynamicResource BorderDarkColor&#125;&quot;</span><br>                                Offset=<span class="hljs-string">&quot;1.0&quot;</span> /&gt;<br>                &lt;/GradientStopCollection&gt;<br>              &lt;/LinearGradientBrush.GradientStops&gt;<br>            &lt;/LinearGradientBrush&gt;<br><br>          &lt;/Border.BorderBrush&gt;<br>          &lt;Border.Background&gt;<br>            &lt;LinearGradientBrush EndPoint=<span class="hljs-string">&quot;0.5,1&quot;</span><br>                                 StartPoint=<span class="hljs-string">&quot;0.5,0&quot;</span>&gt;<br>              &lt;GradientStop Color=<span class="hljs-string">&quot;&#123;DynamicResource ControlLightColor&#125;&quot;</span><br>                            Offset=<span class="hljs-string">&quot;0&quot;</span> /&gt;<br>              &lt;GradientStop Color=<span class="hljs-string">&quot;&#123;DynamicResource ControlMediumColor&#125;&quot;</span><br>                            Offset=<span class="hljs-string">&quot;1&quot;</span> /&gt;<br>            &lt;/LinearGradientBrush&gt;<br>          &lt;/Border.Background&gt;<br>          &lt;VisualStateManager.VisualStateGroups&gt;<br>            &lt;VisualStateGroup x:Name=<span class="hljs-string">&quot;CommonStates&quot;</span>&gt;<br>              &lt;VisualStateGroup.Transitions&gt;<br>                &lt;VisualTransition GeneratedDuration=<span class="hljs-string">&quot;0:0:0.5&quot;</span> /&gt;<br>                &lt;VisualTransition GeneratedDuration=<span class="hljs-string">&quot;0&quot;</span><br>                                  To=<span class="hljs-string">&quot;Pressed&quot;</span> /&gt;<br>              &lt;/VisualStateGroup.Transitions&gt;<br>              &lt;VisualState x:Name=<span class="hljs-string">&quot;Normal&quot;</span> /&gt;<br>              &lt;VisualState x:Name=<span class="hljs-string">&quot;MouseOver&quot;</span>&gt;<br>                &lt;Storyboard&gt;<br>                  &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty=<span class="hljs-string">&quot;(Panel.Background).</span><br><span class="hljs-string">                      (GradientBrush.GradientStops)[1].(GradientStop.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource ControlMouseOverColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                &lt;/Storyboard&gt;<br>              &lt;/VisualState&gt;<br>              &lt;VisualState x:Name=<span class="hljs-string">&quot;Pressed&quot;</span>&gt;<br>                &lt;Storyboard&gt;<br>                  &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty=<span class="hljs-string">&quot;(Panel.Background).</span><br><span class="hljs-string">                      (GradientBrush.GradientStops)[1].(GradientStop.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource ControlPressedColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                  &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty=<span class="hljs-string">&quot;(Border.BorderBrush).</span><br><span class="hljs-string">                      (GradientBrush.GradientStops)[0].(GradientStop.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource PressedBorderDarkColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                  &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty=<span class="hljs-string">&quot;(Border.BorderBrush).</span><br><span class="hljs-string">                      (GradientBrush.GradientStops)[1].(GradientStop.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource PressedBorderLightColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                &lt;/Storyboard&gt;<br>              &lt;/VisualState&gt;<br>              &lt;VisualState x:Name=<span class="hljs-string">&quot;Disabled&quot;</span>&gt;<br>                &lt;Storyboard&gt;<br>                  &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty=<span class="hljs-string">&quot;(Panel.Background).</span><br><span class="hljs-string">                      (GradientBrush.GradientStops)[1].(GradientStop.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource DisabledControlDarkColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                  &lt;ColorAnimationUsingKeyFrames<br>                      Storyboard.TargetProperty=<span class="hljs-string">&quot;(TextBlock.Foreground).(SolidColorBrush.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource DisabledForegroundColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                  &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty=<span class="hljs-string">&quot;(Border.BorderBrush).</span><br><span class="hljs-string">                      (GradientBrush.GradientStops)[1].(GradientStop.Color)&quot;</span><br>                                                Storyboard.TargetName=<span class="hljs-string">&quot;Border&quot;</span>&gt;<br>                    &lt;EasingColorKeyFrame KeyTime=<span class="hljs-string">&quot;0&quot;</span><br>                                         Value=<span class="hljs-string">&quot;&#123;StaticResource DisabledBorderDarkColor&#125;&quot;</span> /&gt;<br>                  &lt;/ColorAnimationUsingKeyFrames&gt;<br>                &lt;/Storyboard&gt;<br>              &lt;/VisualState&gt;<br>            &lt;/VisualStateGroup&gt;<br>          &lt;/VisualStateManager.VisualStateGroups&gt;<br>          &lt;ContentPresenter Margin=<span class="hljs-string">&quot;2&quot;</span><br>                            HorizontalAlignment=<span class="hljs-string">&quot;Center&quot;</span><br>                            VerticalAlignment=<span class="hljs-string">&quot;Center&quot;</span><br>                            RecognizesAccessKey=<span class="hljs-string">&quot;True&quot;</span> /&gt;<br>        &lt;/Border&gt;<br>        &lt;ControlTemplate.Triggers&gt;<br>          &lt;Trigger Property=<span class="hljs-string">&quot;IsDefault&quot;</span><br>                   Value=<span class="hljs-string">&quot;true&quot;</span>&gt;<br><br>            &lt;Setter TargetName=<span class="hljs-string">&quot;Border&quot;</span><br>                    Property=<span class="hljs-string">&quot;BorderBrush&quot;</span>&gt;<br>              &lt;Setter.Value&gt;<br>                &lt;LinearGradientBrush StartPoint=<span class="hljs-string">&quot;0,0&quot;</span><br>                                     EndPoint=<span class="hljs-string">&quot;0,1&quot;</span>&gt;<br>                  &lt;GradientBrush.GradientStops&gt;<br>                    &lt;GradientStopCollection&gt;<br>                      &lt;GradientStop Color=<span class="hljs-string">&quot;&#123;DynamicResource DefaultBorderBrushLightBrush&#125;&quot;</span><br>                                    Offset=<span class="hljs-string">&quot;0.0&quot;</span> /&gt;<br>                      &lt;GradientStop Color=<span class="hljs-string">&quot;&#123;DynamicResource DefaultBorderBrushDarkColor&#125;&quot;</span><br>                                    Offset=<span class="hljs-string">&quot;1.0&quot;</span> /&gt;<br>                    &lt;/GradientStopCollection&gt;<br>                  &lt;/GradientBrush.GradientStops&gt;<br>                &lt;/LinearGradientBrush&gt;<br><br>              &lt;/Setter.Value&gt;<br>            &lt;/Setter&gt;<br>          &lt;/Trigger&gt;<br>        &lt;/ControlTemplate.Triggers&gt;<br>      &lt;/ControlTemplate&gt;<br>    &lt;/Setter.Value&gt;<br>  &lt;/Setter&gt;<br>&lt;/Style&gt;<br><br></code></pre></td></tr></table></figure>

<ul>
<li>控件的实现提供了数据模型和交互模型。<ul>
<li>交互模型定义了一组命令（如窗口的“关闭”），以及到输入笔势的绑定（如单击窗口右上角的红叉）。 </li>
<li>数据模型提供了一组属性，用于自定义交互模型或自定义显示内容（由模板确定）。<ul>
<li>最常见的控件数据模型是内容模型。</li>
</ul>
</li>
<li>利用数据模板，可以通过声明方式指定某个数据片断的可视化方式。无需创建可绑定到数据的自定义用户界面，而是转而让数据来确定要创建的显示内容。</li>
<li>样式实际上是轻量型的数据绑定。 使用样式，可以将共享定义的一组属性绑定到元素的一个或多个实例。</li>
</ul>
</li>
<li></li>
</ul>
<h1 id="三、Windows-Presentation-Foundation-WPF-实现-XAML-处理器实现并提供-XAML-语言支持"><a href="#三、Windows-Presentation-Foundation-WPF-实现-XAML-处理器实现并提供-XAML-语言支持" class="headerlink" title="三、Windows Presentation Foundation (WPF) 实现 XAML 处理器实现并提供 XAML 语言支持"></a>三、Windows Presentation Foundation (WPF) 实现 XAML 处理器实现并提供 XAML 语言支持</h1><p>……开个头，继续看</p>
<hr>
<h1 id="巨人的肩膀"><a href="#巨人的肩膀" class="headerlink" title="巨人的肩膀"></a>巨人的肩膀</h1><ul>
<li><a target="_blank" rel="noopener" href="https://learn.microsoft.com/zh-cn/dotnet/desktop/wpf/advanced/?view=netframeworkdesktop-4.8">https://learn.microsoft.com/zh-cn/dotnet/desktop/wpf/advanced/?view=netframeworkdesktop-4.8</a></li>
<li><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/1342886">https://cloud.tencent.com/developer/article/1342886</a></li>
<li>官方手册：<a target="_blank" rel="noopener" href="https://learn.microsoft.com/zh-tw/dotnet/desktop/wpf/advanced/wpf-architecture?view=netframeworkdesktop-4.8">https://learn.microsoft.com/zh-tw/dotnet/desktop/wpf/advanced/wpf-architecture?view=netframeworkdesktop-4.8</a></li>
<li>Head First 设计模式</li>
<li>设计模式之禅</li>
<li>公众号啦、OSCHINA啦、上面的有关设计模式的文章</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="https://aiminminai.gitee.io/aiminminai">Hu hb</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="https://aiminminai.gitee.io/aiminminai/2024/02/24/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86-01-WPF%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/">https://aiminminai.gitee.io/aiminminai/2024/02/24/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86-01-WPF%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/aiminminai/tags/WPF%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84/">WPF体系结构</a><a class="post-meta__tags" href="/aiminminai/tags/INotifyPropertyChanged/">INotifyPropertyChanged</a><a class="post-meta__tags" href="/aiminminai/tags/ICommand/">ICommand</a></div><div class="post_share"><div class="social-share" data-image="/aiminminai/img/avatar.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> Donate</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/aiminminai/img/WeChat.jpg" target="_blank"><img class="post-qr-code-img" src="/aiminminai/img/WeChat.jpg" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li><li class="reward-item"><a href="/aiminminai/img/Alipay.jpg" target="_blank"><img class="post-qr-code-img" src="/aiminminai/img/Alipay.jpg" alt="alipay"/></a><div class="post-qr-code-desc">alipay</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/aiminminai/2024/02/27/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86-02-WPF%E4%B8%AD%E7%9A%84XAML/" title="打破砂锅问-WPF原理-02-WPF中的XAML"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">打破砂锅问-WPF原理-02-WPF中的XAML</div></div></a></div><div class="next-post pull-right"><a href="/aiminminai/2024/02/24/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86/" title="打破砂锅问~WPF原理"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">打破砂锅问~WPF原理</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>Related Articles</span></div><div class="relatedPosts-list"><div><a href="/aiminminai/2024/02/24/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86/" title="打破砂锅问~WPF原理"><div class="cover" style="background: var(--default-bg-color)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-02-24</div><div class="title">打破砂锅问~WPF原理</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/aiminminai/img/avatar.jpg" onerror="this.onerror=null;this.src='/aiminminai/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Hu hb</div><div class="author-info__description">寻寻觅觅，原来未来的你，在这里呀</div></div><div class="card-info-data site-data is-center"><a href="/aiminminai/archives/"><div class="headline">Articles</div><div class="length-num">29</div></a><a href="/aiminminai/tags/"><div class="headline">Tags</div><div class="length-num">47</div></a><a href="/aiminminai/categories/"><div class="headline">Categories</div><div class="length-num">42</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/aiminminai"><i class="Gitee"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="mailto:min221forever@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://github.com/YWMHHBAIminminAI" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/m0_52436398?type=blog" target="_blank" title="CSDN"><i class="fa fa-book-open"></i></a><a class="social-icon" href="https://gitee.com/aiminminai" target="_blank" title="Gitee"><i class="fa fa-g"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>Announcement</span></div><div class="announcement_content"><b><font color="#e66b6d">掬</font> <font color="#e66d98">水</font> <font color="#e66cc6">月</font> <font color="#cc6de6">在</font> <font        color="#9770e6">手</font> <font color="#6d93e6">，</font> <font color="#6fcde6">弄</font> <font color="#72e6b6">花</font> <font color="#72e689">香</font> <font color="#99e670">满</font> <font color="#cde670">衣</font> <p align="center"><img src="https://haiyong.site/img/img-blog.csdnimg.cn/f7384c88956d4378b72e47548e19c9f8.gif" width="50" alt="mao"></p> <p align="center">微信号：phone_15902953075</p> <p align="center">QQ号：1317957931</p></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%80%E3%80%81Windows-Presentation-Foundation-WPF"><span class="toc-number">2.</span> <span class="toc-text">一、Windows Presentation Foundation (WPF)</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%85%88%E8%A1%A5%E4%B8%AA%E4%BD%9C%E4%B8%9A%EF%BC%9A"><span class="toc-number">2.1.</span> <span class="toc-text">1.先补个作业：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-WPF-%E4%B8%BB%E8%A6%81%E7%BC%96%E7%A8%8B%E6%A8%A1%E5%9E%8B%E7%BC%96%E5%86%99%E3%80%82"><span class="toc-number">2.2.</span> <span class="toc-text">2.WPF 主要编程模型编写。</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-WPF-%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E6%98%BE%E7%A4%BA%E5%9D%87%E9%80%9A%E8%BF%87-DirectX-%E5%BC%95%E6%93%8E%E5%AE%8C%E6%88%90"><span class="toc-number">2.3.</span> <span class="toc-text">3.WPF 中的所有显示均通过 DirectX 引擎完成</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-WPF-%E4%B8%AD%E7%9A%84%E5%A4%A7%E5%A4%9A%E6%95%B0%E5%AF%B9%E8%B1%A1%E6%B4%BE%E7%94%9F%E8%87%AA-DispatcherObject"><span class="toc-number">2.4.</span> <span class="toc-text">4.WPF 中的大多数对象派生自 DispatcherObject</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-System-Windows-DependencyObject"><span class="toc-number">2.5.</span> <span class="toc-text">5.System.Windows.DependencyObject</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-System-Windows-Media-Visual"><span class="toc-number">2.6.</span> <span class="toc-text">6.System.Windows.Media.Visual</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-System-Windows-UIElement"><span class="toc-number">2.7.</span> <span class="toc-text">7.System.Windows.UIElement</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%8C%E3%80%81%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B%EF%BC%88%E5%B1%9E%E6%80%A7%EF%BC%89%E3%80%81%E4%BA%A4%E4%BA%92%E6%A8%A1%E5%9E%8B%EF%BC%88%E5%91%BD%E4%BB%A4%E5%92%8C%E4%BA%8B%E4%BB%B6%EF%BC%89%E5%8F%8A%E6%98%BE%E7%A4%BA%E6%A8%A1%E5%9E%8B%EF%BC%88%E6%A8%A1%E6%9D%BF%EF%BC%89%E4%B9%8B%E9%97%B4%E7%9A%84%E5%88%92%E5%88%86%EF%BC%8C%E5%8F%AF%E5%AE%9E%E7%8E%B0%E5%AF%B9%E6%8E%A7%E4%BB%B6%E7%9A%84%E5%A4%96%E8%A7%82%E5%92%8C%E8%A1%8C%E4%B8%BA%E7%9A%84%E5%AE%8C%E5%85%A8%E8%87%AA%E5%AE%9A%E4%B9%89"><span class="toc-number">3.</span> <span class="toc-text">二、数据模型（属性）、交互模型（命令和事件）及显示模型（模板）之间的划分，可实现对控件的外观和行为的完全自定义</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%89%E3%80%81Windows-Presentation-Foundation-WPF-%E5%AE%9E%E7%8E%B0-XAML-%E5%A4%84%E7%90%86%E5%99%A8%E5%AE%9E%E7%8E%B0%E5%B9%B6%E6%8F%90%E4%BE%9B-XAML-%E8%AF%AD%E8%A8%80%E6%94%AF%E6%8C%81"><span class="toc-number">4.</span> <span class="toc-text">三、Windows Presentation Foundation (WPF) 实现 XAML 处理器实现并提供 XAML 语言支持</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B7%A8%E4%BA%BA%E7%9A%84%E8%82%A9%E8%86%80"><span class="toc-number">5.</span> <span class="toc-text">巨人的肩膀</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/aiminminai/2024/03/28/%E9%A1%B9%E7%9B%AE%E5%BC%80%E5%8F%91%E6%80%BB%E7%BB%93%E4%B9%8BC-%E5%86%99%E4%BA%86%E4%B8%80%E4%B8%AA%E4%B8%8A%E4%BD%8D%E6%9C%BA%E9%A1%B5%E9%9D%A2%EF%BC%8C%E8%BD%AF%E4%BB%B6%E5%8D%A1%E6%AD%BB%E4%BA%86%EF%BC%9F%EF%BC%9F%EF%BC%9F/" title="项目开发总结之C#写了一个上位机页面，软件卡死了？？？">项目开发总结之C#写了一个上位机页面，软件卡死了？？？</a><time datetime="2024-03-28T15:41:40.000Z" title="Created 2024-03-28 23:41:40">2024-03-28</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/aiminminai/2024/03/27/Golang-web-http%E6%A1%86%E6%9E%B6/" title="Golang-web/http框架">Golang-web/http框架</a><time datetime="2024-03-27T15:27:12.000Z" title="Created 2024-03-27 23:27:12">2024-03-27</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/aiminminai/2024/03/24/Golang-%E7%BB%83%E5%9F%BA%E6%9C%AC%E5%8A%9F%EF%BC%9A%E6%89%8E%E9%A9%AC%E6%AD%A5%E3%80%81%E7%BB%83%E6%8A%95%E7%AF%AE/" title="Golang-练基本功：扎马步、练投篮、练运球">Golang-练基本功：扎马步、练投篮、练运球</a><time datetime="2024-03-24T15:42:23.000Z" title="Created 2024-03-24 23:42:23">2024-03-24</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/aiminminai/2024/03/15/%E8%83%BD%E4%B8%8D%E8%83%BD%E7%BB%99%E5%88%AB%E4%BA%BA%E4%B8%80%E4%B8%AA%E4%B8%8A%E6%89%8B%E5%B0%B1%E8%83%BD%E7%9C%8B%E6%87%82%E5%B0%B1%E8%83%BD%E7%94%A8%E7%9A%84%E4%B8%89%E5%B1%82%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C%EF%BC%88%E4%BB%A3%E7%A0%81%EF%BC%89%E6%A8%A1%E5%9E%8B%E5%91%A2%EF%BC%9F/" title="能不能给别人一个上手就能看懂就能用的三层神经网络（代码）模型呢？">能不能给别人一个上手就能看懂就能用的三层神经网络（代码）模型呢？</a><time datetime="2024-03-14T16:23:21.000Z" title="Created 2024-03-15 00:23:21">2024-03-15</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/aiminminai/2024/02/28/%E6%89%93%E7%A0%B4%E7%A0%82%E9%94%85%E9%97%AE-WPF%E5%8E%9F%E7%90%86-03-WPF%E6%A0%B7%E5%BC%8F%E8%AE%BE%E7%BD%AE%E5%92%8C%E6%A8%A1%E6%9D%BF%E5%8C%96%E3%80%81%E5%86%85%E8%81%94%E6%A0%B7%E5%BC%8F%E5%92%8C%E6%A8%A1%E6%9D%BF/" title="打破砂锅问-WPF原理-03-WPF样式设置和模板化、内联样式和模板">打破砂锅问-WPF原理-03-WPF样式设置和模板化、内联样式和模板</a><time datetime="2024-02-28T15:10:28.000Z" title="Created 2024-02-28 23:10:28">2024-02-28</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2024 By Hu hb</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><button id="chat-btn" type="button" title="Chat"><i class="fas fa-sms"></i></button><button id="go-up" type="button" title="Back To Top"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/aiminminai/js/utils.js"></script><script src="/aiminminai/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/click-heart.min.js" async="async" mobile="false"></script><script>(() => {
  const isChatBtn = true
  const isChatHideShow = true

  if (isChatBtn) {
    const close = () => {
      Chatra('minimizeWidget')
      Chatra('hide')
    }

    const open = () => {
      Chatra('openChat', true)
      Chatra('show')
    }

    window.ChatraSetup = {
      startHidden: true
    }
  
    window.chatBtnFn = () => {
      const isShow = document.getElementById('chatra').classList.contains('chatra--expanded')
      isShow ? close() : open()
    }
  } else if (isChatHideShow) {
    window.chatBtn = {
      hide: () => {
        Chatra('hide')
      },
      show: () => {
        Chatra('show')
      }
    }
  }

  (function(d, w, c) {
    w.ChatraID = 't3Zijv5iKg5Z5HT6v'
    var s = d.createElement('script')
    w[c] = w[c] || function() {
        (w[c].q = w[c].q || []).push(arguments)
    }
    s.async = true
    s.src = 'https://call.chatra.io/chatra.js'
    if (d.head) d.head.appendChild(s)
  })(document, window, 'Chatra')

})()</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>